import math
import numpy as np


def g(k, u, v):
    kk = k ** 2
    v1 = 1/(2 * math.pi * kk)
    v2 = math.pow(math.e, -1 * ((u**2 + v**2)/ (2 * kk)))
    return v1 * v2


def generate_g(size, scale):
    center_x = int(size/2)
    center_y = int(size/2)
    result = np.zeros((size, size))
    value_sum = 0
    for row in range(size):
        for col in range(size):
            dy = row - center_y
            dx = col - center_x
            value = g(1.4, dx, dy)
            value_sum += value
            
            result[row, col] = value
            
    result = (result/value_sum) * scale + 0.5
    print(result.astype(np.int32))
    #for row in range(size):
        #for col in range(size):
            #end_char = "\t" if col < size -1 else ""
            #print(int(result[row, col]), end=end_char)
        #print('\r\n', end = "")
        
    
if __name__ == "__main__":
    generate_g(5, 159)